﻿Imports System.ComponentModel
Imports System.Runtime.CompilerServices
Imports System.Runtime.InteropServices

Public Class SettingsView
    Implements INotifyPropertyChanged
    Public Event PropertyChanged As PropertyChangedEventHandler _
    Implements INotifyPropertyChanged.PropertyChanged
    Private Sub NotifyPropertyChanged(<CallerMemberName()> Optional ByVal propertyName As String = Nothing)
        RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propertyName))
    End Sub


    Private _Settings As Boolean = False
    Public Property Settings() As Boolean
        Get
            Return _Settings
        End Get
        Set(ByVal value As Boolean)

            _Settings = value
            NotifyPropertyChanged()

        End Set
    End Property

    Private _About As Boolean = False
    Public Property About() As Boolean
        Get
            Return _About
        End Get
        Set(ByVal value As Boolean)

            _About = value
            NotifyPropertyChanged()

        End Set
    End Property

    Private _Nic As Boolean = True
    Public Property NIC() As Boolean
        Get
            Return _Nic
        End Get
        Set(ByVal value As Boolean)

            _Nic = value
            NotifyPropertyChanged()

        End Set
    End Property




    Private Sub SettingsView_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded

        Me.DataContext = Application._MainViewModel.AppSettings
        If Application._MainViewModel.SelectedInterface Is Nothing Then
            Application._MainViewModel.LoadNetworkInterfaces()
            NIC = True
            Me.Title = "Tunlr.Sync - Network Card"
        End If

    End Sub

    Private Sub TglButtonNIC_Checked_1(sender As Object, e As RoutedEventArgs)
        On Error Resume Next
        Me.TglButtonAbout.IsChecked = False
        Me.TglButtonSettings.IsChecked = False
        Me.TglButtonNIC.IsChecked = True
        e.Handled = True
        Me.Title = "Tunlr.Sync - Network Adapter"

    End Sub

    Private Sub TglButtonSettings_Checked_1(sender As Object, e As RoutedEventArgs)
        On Error Resume Next
        Me.TglButtonAbout.IsChecked = False
        Me.TglButtonSettings.IsChecked = True
        Me.TglButtonNIC.IsChecked = False
        e.Handled = True
        Me.Title = "Tunlr.Sync - Settings"

    End Sub

    Private Sub TglButtonAbout_Checked_2(sender As Object, e As RoutedEventArgs)
        On Error Resume Next
        Me.TglButtonNIC.IsChecked = False
        Me.TglButtonSettings.IsChecked = False
        Me.TglButtonAbout.IsChecked = True
        e.Handled = True
        Me.Title = "Tunlr.Sync - About"

    End Sub

End Class
